<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="_meta :: header">
    <title>列表</title>
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">音频表列表</a>
            <a><cite>音频表管理</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="float: right;height: 30px;line-height: 30px;margin-top: 5px;" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form action="#" class="layui-form layui-col-space5" th:action="@{/admin/audio/audioLeaderSuccess}" method="post">
<!--                                    <div class="layui-inline ">-->
<!--                                    <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.draftId}" name="draftId" placeholder="搜索稿件id" id="draftId" />-->
<!--                                    </div>-->
<!--                                    <div class="layui-inline ">-->
<!--                                    <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.pptUrl}" name="pptUrl" placeholder="搜索ppt储存地址" id="pptUrl" />-->
<!--                                    </div>-->
<!--                                    <div class="layui-inline ">-->
<!--                                        <input type="text" class="layui-input timeSpace" placeholder="搜索提交时间" name="submitTimeSpace" th:value="${submitTimeSpace}" />-->
<!--                                    </div>-->
                                    <div class="layui-inline ">
                                    <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.audioPerson}" name="pptMaker" placeholder="搜索音频录作人" id="audioPerson" />
                                    </div>
<!--                                    <div class="layui-inline ">-->
<!--                                    <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.statusCode}" name="statusCode" placeholder="搜索状态code" id="statusCode" />-->
<!--                                    </div>-->
<!--                                    <div class="layui-inline ">-->
<!--                                    <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.isDelete}" name="isDelete" placeholder="搜索是否删除（1是0否）" id="isDelete" />-->
<!--                                    </div>-->
                        <div class="layui-inline">
                            <button type="submit" class="layui-btn  layui-btn-success radius"><i class="layui-icon">&#xe615;</i>
                            </button>
                        </div>
                        <div class="cl pd-5 bg-1 bk-gray " >

                            <span class="r wei-height" style="float: right;margin-right: 20px">共有数据：<strong
                                        th:text="${pageInfo.total}"></strong> 条</span>
                        </div>
                        <div class="layui-card-body" style="text-align: center">
                            <table class="layui-table layui-form">
                                <thead>
                                <tr class="text-c">
<!--                                    <th width="25"><input type="checkbox" name="" value="" lay-filter="checkall" lay-skin="primary"/></th>-->
                                    <th width="25">序号</th>
<!--                                        <th width="40">稿件id</th>-->
                                    <th width="40">稿件标题</th>
                                    <th width="40">文件名</th>
                                    <th width="40">组名</th>
                                    <th width="40">音频预览</th>
                                        <th width="40">提交时间</th>
                                        <th width="40">音频录作人</th>
                                        <th width="40">状态</th>
<!--                                        <th width="40">是否删除</th>-->
<!--                                        <th width="40">创建时间</th>-->
<!--                                        <th width="40">修改时间</th>-->
                                    <th width="40">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr class="text-c" th:if="${pageInfo.list.size() == 0}">
                                    <td colspan="15"><strong>暂无数据</strong></td>
                                </tr>
                                <tr class="text-c" th:each="audio,count:${pageInfo.list}">
<!--                                    <td><input type="checkbox" value="1" th:value="${audio.id}"-->
<!--                                               name="id" lay-skin="primary"/></td>-->
                                    <td th:text="${count.count}"></td>
                                    <td th:text="${audio.draftTitle}"></td>
                                    <td th:text="${audio.fileName}"></td>
                                    <td th:text="${audio.groupName}"></td>
                                    <!--                                                <td th:text="${audio.draftId}"></td>-->
                                            <td><audio th:src="${audio.audioUrl}" controls="controls"></audio></td>
                                            <td th:text="${#temporals.format(audio.submitTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                            <td th:text="${audio.audioPerson}"></td>
                                            <td th:if="${audio.statusCode}==1014" th:text="已通过"></td>
<!--                                                <td th:text= "${audio.isDelete}"></td>-->
<!--                                            <td th:text="${#temporals.format(audio.createTime, 'yyyy-MM-dd HH:mm:ss')}"></td>-->
<!--                                            <td th:text="${#temporals.format(audio.updateTime, 'yyyy-MM-dd HH:mm:ss')}"></td>-->
                                    <td class="td-manage">
                                        <a title="查看" href="javascript:;"
                                           th:onclick="'javascript:layer_show(\'查看\',\'/admin/'+'draft'+'/unMakeAudioBefore/'+${audio.draftId}+'\',900,500)'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe615;</i></a>
                                        <a title="操作记录" href="javascript:;"
                                           th:onclick="'javascript:layer_show(\'操作记录\',\'/admin/'+'draftLog'+'/operation/'+${audio.draftId}+'\',1000,500)'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe60e;</i></a>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div th:include="_pagination :: page"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs">
</div>
<!--/_footer 作为公共模版分离出去-->
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
        // 监听全选
        form.on('checkbox(checkall)', function(data){

            if(data.elem.checked){
                $('tbody input').prop('checked',true);
            }else{
                $('tbody input').prop('checked',false);
            }
            form.render('checkbox');
        });
        form.on('select(selectchange)', function(data){
            console.log(data.value); //得到被选中的值
            var pageNo = $('#pageNo');
            var Form = $('form')
            pageNo.val(1);
            Form.submit();
            form.render('select');
        });
        //日期时间范围选择
        laydate.render({

        });
        lay('.timeSpace').each(function(){
            laydate.render({
                elem: this
                ,type: 'datetime'
                ,range: true //或 range: '~' 来自定义分割字符
            });
        });
    });

    // PPT分配---弹出层
    /**
     * 张雪
     * 分配btn弹出层
     */
    function audio_allot_show(title,url,w,h){
        if(allotAll("/admin/allot/getIdsList") == false){
            layer.msg("请选择分配的数据");
        }else{
            if (title == null || title == '') {
                title=false;
            };
            if (url == null || url == '') {
                url="404.html";
            };
            if (w == null || w == '') {
                w=800;
            };
            if (h == null || h == '') {
                h=($(window).height() - 50);
            };
            layer.open({
                type: 2,
                area: [w+'px', h +'px'],
                fix: false, //不固定
                maxmin: true,
                shade:0.4,
                title: title,
                content: url
            });
        }

    }
    /**
     * 张雪
     * 批量分配
     * @param url
     * @returns {boolean}
     */
    function allotAll(url){
        var _list = new Array();
        $('input[name="id"]:checked').each(
            function (i) {
                _list[i] = $(this).val();
            });
        if(_list.length == 0){
            return false;
        }
        $.ajax({
            url:url,// 跳转到 action
            data:JSON.stringify(_list),
            type:'post',
            cache:false,
            dataType:'json',
            contentType:"application/json",  //发送信息至服务器时内容编码类型。
            success:function(data) {
                if(data.code == "1"){
                    layer.msg('分配成功!',{icon:1,time:1000,end:function() {
                            window.location.reload();
                        }});
                }else{
                    layer.msg('分配成功!',{icon:1,time:1000,end:function() {
                            window.location.reload();
                        }});
                }
            }
        });

    }


</script>
</body>
</html>